package org.knot.mockejb3.plugin.hibernate;

import java.util.HashMap;
import java.util.Map;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 * 
 * Hibernate的帮助类
 * 
 * @author yuxiaowei
 *
 */
public class HibernateHelper {
    
    
	/*
	 * A static method for other application to get SessionFactory object
	 * initialized in this helper class.
	 * 
	 */
	public static SessionFactory getSessionFactory(String sfJndi) {
	    SessionFactory sessionFactory = null;
	    try {
	           sessionFactory = new Configuration().configure(sfJndi).buildSessionFactory();
        } catch (Throwable e) {
            throw new ExceptionInInitializerError(e);
        }
		return sessionFactory;
	}
}
